<template>
    <view :style="theme" class="page">
		<!--头部-->
		<view class="d-kuan " :style="{'background-color': fenggeyanse =='light'? '#69bd7d':'#313131'}">
			<!--view class="d-kuan d-gao-60"></view-->
			<view class="d-neikuang-10">
				<view class="d-kuan d-buhuanhang">
					<view class="d-kuan-60">
						<image src="/static/images/img/remen2.png" mode="aspectFill" class="d-img-60 d-yuanjiao-50 d-beijing-hui"></image>
					</view>
					<view class="d-kuan d-zuo-10">
						<view class="d-jiacu d-wenzi-yanse-bai">热门帖子</view>
						<view class="d-wenzi-yanse-bai d-wenzi-tongming-5">热门帖子 : 20</view>
					</view>
				</view>
				<view class="d-beijing-bai-10  d-neirong-juzhong d-hanggao-30 d-shangxia-10 d-yuanjiao-10 d-wenzi-yanse-bai">
					热门圈贴
				</view>
				
			</view>
		</view>

		<!-- 列表template模板 -->
		<view class="d-yuanjiao-10">
			<view class="d-neikuang-zuoyou-6-shangxia-10">
				<u-row >
					<u-col span="4">
						<view  class="d-kuan d-buhuanhang">
						<u-icon class="d-shang-3" name="file-text" size="20"></u-icon> <view> 热门帖子</view>
						</view>
					</u-col>
					<u-col span="4">
						<view class="demo-layout bg-purple-light"></view>
					</u-col>
					<u-col span="4">
						<view v-if="fenggekaiguan == 0"  class="d-kuan">
						<view  class="d-kuan-40 d-you">
							<u-icon class="d-shang-3 d-you" name="list-dot" @click="fenggeshow = true" size="25"></u-icon>
						</view>
						</view>
					</u-col>
				</u-row>
			</view>
		</view>
		<u-picker
			:show="fenggeshow" 
			:columns="fenggevalue"
			:closeOnClickOverlay="true"
			title="选择风格"
			@cancel="fenggeshow = false"
			@confirm="fenggeshow = false"
			@change="fenggevalues"
		></u-picker>
		
		<view v-if="fengge == 2" >
			<Dwaterfall
			:dataList="postsList" 
			:column="columns" 
			@click="click" 
			@tiezi="tiezi"
			@getgeren="getgeren"
			@dianzan="dianzan"
			></Dwaterfall>
			<u-loading-icon text="加载中..." textSize="18" :show="xialajiazai" ></u-loading-icon>
			<view :style="'display:' + (isLoading?'block':'none')">
				<template is="tempLoading"></template>
			</view>
			<view class="loadingmore" :style="'display:' + floatDisplay">
				<view class="no-more" :hidden="!isLastPage">- 无更多文章 -</view>
			</view>
			<u-divider text="已经到底啦 !" v-if="daodi">{{daodi}}</u-divider>
			<!-- 版权信息template模板 -->
			<view class="copyright" :style="'display:' + floatDisplay">
				<block data-type="template" data-is="tempCopyright" data-attr="webSiteName:webSiteName,domain:domain">
					<view> {{webSiteName}} </view>
					<view> {{banbenhao}} </view>
				</block>
			</view>
		</view>
		<view v-else-if="fengge == 3" >
			<block v-for="(item, index) in postsList" :key="index">
				<view class="d-kuan d-xia-10 d-beijing-bai">
					<view class="d-waikuang-10">
						<view class="d-kuan d-yuanjiao-10 d-shangxia-neikuang-10">
							<view class="u-page ">
								<view class="u-demo-block ">
									<view class="u-demo-block__content">
										<view class="album">
											<view class="album__avatar d-yuanjiao-50">
												
												<view class="d-gaokuang-40 d-kuanggao-40 d-yuanjiao-40 d-box" @click="getgeren(item.uid)">
													<image v-if="item.touxiang" :src="item.touxiang" mode="aspectFill" class="d-img-40 d-yuanjiao-50 "></image>
													<image v-else src="/static/assets/images/avatar.png" mode="aspectFill" class="d-img-40 d-yuanjiao-50 "></image>
													<image v-if="item.rzs == 1" :src="v" mode="aspectFill" class="d-img-10 d-yuanjiao-50  d-box-xia"></image>
												</view>
											</view>
											<view class="album__content">
												
												<u--text
												  :text="item.mingcheng"
												  type=""
												  bold
												  size="16"
												></u--text>
												<view class="d-wenzi-14 d-wenzi-yanse-hui">{{item.yonghuzu}}. {{item.guishudi}}</view>
												<!--标题-->
												<view v-if="item.title" class="d-jiacu d-shang-10 d-wenzi-16 d-xia-10 d-younei-10" @click="tiezi(item.cid,item.id)">{{item.title}}</view>
												<view class=" d-wenzi-14 d-wenzi-huanhang d-wenzi-yanse-hui" @click="tiezi(item.cid,item.id)">
													{{item.neirong}}
												</view>
												<!--u--text
												@click="tiezi(item.cid,item.id)"
												  margin="5px 1px 10px 0"
												  :text="item.neirong"
												></u--text-->
												<u-album class="d-shang-10" singleSize="250" multipleSize="90" :previewFullImage="false" :urls="item.tuji"></u-album>
												<!--u-divider text=""></u-divider-->
												<!--评论-->
												<view class="d-shang-10">
													<view class="d-wenzi-12 d-shang-10 d-kuan-baifen-50 d-zuo d-wenzi-yanse-hui">
														{{item.shijian}}
													</view>
													<view class="d-wenzi-12 d-kuan-baifen-50 d-zuo d-wenzi-yanse-hui">
														<view class="d-wenzi-12 d-kuan-baifen-50 d-zuo d-neirong-zuo d-buhuanhang d-shang-4" @click="tiezi(item.cid,item.id)">
															<!--image src="/static/images/img/xiaoxi3.png" class="d-img-25"></image-->
															<u-icon :label="item.comments" size="28" name="/static/images/img/xiaoxi3.png"></u-icon>
															
														</view>
														<view class="d-wenzi-12 d-kuan-baifen-50 d-zuo d-neirong-you" :id="'zan'+item.id">
															
															<image v-if="item.zanzhi == 1" src="/static/images/img/dianzan2.png" class="d-img-35" @click="dianzan(index,item.id)"></image>
															<image v-else src="/static/images/img/zan3.png" class="d-img-35" @click="dianzan(index,item.id)"></image>
															<!--u-icon size="35" name="/static/images/img/zan3.png"></u-icon-->
														</view>
													</view>
													<view class="d-clear"></view>
												</view>
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</block>
			<u-loading-icon text="加载中..." textSize="18" :show="xialajiazai" ></u-loading-icon>
			<view :style="'display:' + (isLoading?'block':'none')">
				<template is="tempLoading"></template>
			</view>
			<view class="loadingmore" :style="'display:' + floatDisplay">
				<view class="no-more" :hidden="!isLastPage">- 无更多文章 -</view>
			</view>
			<u-divider text="已经到底啦 !" v-if="daodi">{{daodi}}</u-divider>
			<!-- 版权信息template模板 -->
			<view class="copyright" :style="'display:' + floatDisplay">
				<block data-type="template" data-is="tempCopyright" data-attr="webSiteName:webSiteName,domain:domain">
					<view> {{webSiteName}} </view>
					<view> {{banbenhao}} </view>
				</block>
			</view>
		</view>
		<view v-else class="d-kuan">
			<block data-type="template" data-is="tempCommonList" data-attr="postsList:postsList,listAdsuccess:listAdsuccess">
				<block v-for="(item, index) in postsList" :key="index">
					<view class="d-kuan">
						<view class="d-waikuang-10">
							<view class="d-kuan d-beijing-bai d-yuanjiao-10">
								<view class="d-neikuang-10 d-buhuanhang">
									<!--头像-->
									<!--头像-->
									<view class="d-gaokuang-40 d-kuanggao-40 d-yuanjiao-40 d-box" @click="getgeren(item.uid)">
										<image v-if="item.touxiang" :src="item.touxiang" mode="aspectFill" class="d-img-40 d-yuanjiao-50 d-beijing-hui"></image>
										<image v-else src="/static/assets/images/avatar.png" mode="aspectFill" class="d-img-40 d-yuanjiao-50 d-beijing-hui"></image>
										<image v-if="item.rzs == 1" :src="v" mode="aspectFill" class="d-img-10 d-yuanjiao-50 d-beijing-hui d-box-xia"></image>
									</view>
									<view class="d-kuan d-zuo-10">
										<view class="d-wenzi-14 d-jiacu">{{item.mingcheng}}</view>
										<view class="d-wenzi-14 d-wenzi-yanse-hui">{{item.yonghuzu}}. {{item.guishudi}}</view>
									</view>
									<view class="d-kuan-80 d-neirong-you" >
										<view class="d-kuan-40 d-beijing-hui-f6 d-neikuang-zuoyou-2-shangxia-4 d-wenzi-12 d-yuanjiao-50 d-neirong-juzhong" >关 注</view>
									</view>
								</view>
								<view class="d-zuoyou-neikuang-10">
									<!--标题-->
									<view v-if="item.title" class="d-jiacu d-wenzi-16 d-xia-10" @click="tiezi(item.cid,item.id)">{{item.title}}</view>
									<view class=" d-wenzi-14 d-wenzi-huanhang d-wenzi-yanse-hui" @click="tiezi(item.cid,item.id)">
										{{item.neirong}}
									</view>
									<!--帖子内容图片-->
									<view class="d-fu-kuan-10" @click="tiezi(item.cid,item.id)">
									    <block v-for="(itemtu, indextu) in item.tuji" :key="indextu">
											<view class="d-kuan-30 d-zuo d-liangbian-10" v-if="indextu < 8">
												<image :src="itemtu" mode="aspectFill" class="d-img-100-bai d-yuanjiao-6 d-yinying-10"></image>
											</view>
											
										</block>
										
										<view class="d-clear"></view>
									</view>
									<view class="d-clear"></view>
									<!--评论-->
									<view class="d-shangxia-neikuang-10">
										<view class="d-wenzi-12 d-kuan-baifen-50 d-zuo d-wenzi-yanse-hui">
											{{item.shijian}}
										</view>
										<view class="d-wenzi-12 d-kuan-baifen-50 d-zuo d-wenzi-yanse-hui">
											<view class="d-wenzi-12 d-kuan-baifen-50 d-zuo d-neirong-zuo d-buhuanhang d-shang-4" @click="tiezi(item.cid,item.id)">
												<!--image src="/static/images/img/xiaoxi3.png" class="d-img-25"></image-->
												<u-icon :label="item.comments" size="28" name="/static/images/img/xiaoxi3.png"></u-icon>
												
											</view>
											<view class="d-wenzi-12 d-kuan-baifen-50 d-zuo d-neirong-you" :id="'zan'+item.id">
		
												<image v-if="item.zanzhi == 1" src="/static/images/img/dianzan2.png" class="d-img-35" @click="dianzan(index,item.id)"></image>
												<image v-else src="/static/images/img/zan3.png" class="d-img-35" @click="dianzan(index,item.id)"></image><!--{{item.zanzhi}}-->
												<!--u-icon size="35" name="/static/images/img/zan3.png"></u-icon-->
											</view>
										</view>
										<view class="d-clear"></view>
									</view>
									
								</view>
							</view>
							<!--评论-->
							<view class="">
								
							</view>
						</view>
					</view>
				</block>
			</block>
			<u-loading-icon text="加载中..." textSize="18" :show="xialajiazai" ></u-loading-icon>
			<view :style="'display:' + (isLoading?'block':'none')">
				<template is="tempLoading"></template>
			</view>
			<view class="loadingmore" :style="'display:' + floatDisplay">
				<view class="no-more" :hidden="!isLastPage">- 无更多文章 -</view>
			</view>
			<u-divider text="已经到底啦 !" v-if="daodi">{{daodi}}</u-divider>
			<!-- 版权信息template模板 -->
			<view class="copyright" :style="'display:' + floatDisplay">
				<block data-type="template" data-is="tempCopyright" data-attr="webSiteName:webSiteName,domain:domain">
					<view> {{webSiteName}} </view>
					<view> {{banbenhao}} </view>
				</block>
			</view>
		</view>
		<!-- 无法访问网络 -->
		<view class="showerror" :style="'display:' + showerror">
			<!--image src="/static/images/cry80.png" style="height:100rpx;width:100rpx"></image-->
			<view class="errortext">
				暂时无法访问网络，下拉重试...
			</view>
		</view>
	</view>
</template>

<script>
import toubu from "@/components/toubu/toubu";  //引入组件
import Dwaterfall  from "@/components/d-waterfall/d-waterfall";  //引入组件
var Api = require("../../utils/api.js");
var util = require("../../utils/util.js");

var wxApi = require("../../utils/wxApi.js");
var wxRequest = require("../../utils/wxRequest.js");
import config from "../../utils/config";
var pageCount = config.getPageCount;
var webSiteName = config.getWebsiteName;
var domain = config.getDomain;
var topNav = config.getIndexNav;
var banbenhao = config.getDuixinbanbenhao;

export default {
  data() {
    return {
      postsList: [],
	  tubiaoList: [],

      isLastPage: false,
      page: 1,
	  swiperheight: '',
	  swiperItemHeight: '',
      search: '',
      categories: 0,
      showerror: "none",
      showCategoryName: "",
      categoryName: "",
      showallDisplay: "block",
      displayHeader: "none",
      displaySwiper: "none",
      floatDisplay: "none",
      displayfirstSwiper: "none",
      topNav: topNav,
      webSiteName: webSiteName,
      domain: domain,
      isFirst: false,
      // 是否第一次打开,
      isLoading: false,
	  uid:'',
	  zanzhi: false,
	  userInfo:'',
	  //下载加载提示
	  xialajiazai: false,
	  //到底
	  daodi: false,
	  v:config.getDomain+'/static/default/web/img/V.png',
	  banbenhao:banbenhao,
	  fengge: '',
	  columns:2,
	  fenggeshow: false,
	  fenggevalue: [
	              ['综合型', '瀑布图', '简约型','极简型']
	          ],
	  fenggezhi:'',
	  fenggemoren:'',
	  fenggekaiguan: '',
	  fenggeyanse:'',
    };
  },
	mounted() {
		
	},


  components: {
	  toubu,
	  Dwaterfall
  },
  props: {},
  onShareAppMessage: function () {
    return {
      title: '“' + webSiteName + '”小程序',
      path: 'pages/index/index',
      success: function (res) {// 转发成功
      },
      fail: function (res) {// 转发失败
      }
    };
  },
  onPullDownRefresh: function () {
    var self = this;
    self.setData({
      showerror: "none",
      showallDisplay: "block",
      displaySwiper: "none",
      floatDisplay: "none",
      isLastPage: false,
      page: 1,
      postsShowSwiperList: []
    });
    this.fetchTopFivePosts();


    this.fetchPostsData(self);
  },
  onReachBottom: function () {
    var self = this;
    if (!self.isLastPage) {
      self.setData({
        page: self.page + 1,
		xialajiazai: true,
      });
      console.log('当前页' + self.page);
      this.fetchPostsData(self);
    } else {
      console.log('最后一页');
    }
  },
  onLoad: function (options) {
    uni.setNavigationBarColor({
        frontColor: '#ffffff',
        backgroundColor: '#69bd7d',
        animation: {
            duration: 400,
            timingFunc: 'easeIn'
        }
    });

	this.$nextTick(() => {
		//this.getGao();
	});
	
    var self = this;
	var isFirstStorage = uni.getStorageSync('isFirst'); // console.log(isFirstStorage);
	var userInfo = uni.getStorageSync('userInfo');
	self.userInfo = userInfo;
    self.fetchTopFivePosts();
	
    

    
	//console.log("userInfo1",userInfo);
	if (userInfo) {
		self.showuid = true;
		var member = uni.getStorageSync('member');
		var uid = uni.getStorageSync('memberuid');
		self.uid = uid;
		//console.log("member1",self.uid);
		//console.log("userInfo1",userInfo);
		//self.fetchPostsData(self);
	} else {
		self.uid = '';
		//self.fetchPostsData(self);
	}
	self.fetchPostsData(self); // 判断用户是不是第一次打开，弹出添加到我的小程序提示

    if (!isFirstStorage) {
      self.setData({
        isFirst: true
      });
      uni.setStorageSync('isFirst', 'no'); // console.log(uni.getStorageSync('isFirst'));
      setTimeout(function () {
        self.setData({
          isFirst: false
        });
      }, 5000);
    }
	var fenggezhi = uni.getStorageSync('fenggezhi');
	if(fenggezhi) {
		self.fengge = fenggezhi;
	} else {
		self.fengge = self.fenggemoren
	}
  },
	onReady() {
		this.$nextTick(() => {
		uni.createSelectorQuery().in(this).select('.swiper-item-img').boundingClientRect(data => {
		console.log(data)
		}).exec()
		});
	},

  onShow() {
	
	this.$nextTick(() => {
		//this.getGao();
	});
    uni.setStorageSync('openLinkCount', 0);
    var nowDate = new Date();
    nowDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + '-' + nowDate.getDate();
    nowDate = new Date(nowDate).getTime();
	// 暗黑模式
	var duixin = this;
	var initialThemes = uni.getStorageSync('theme');
	duixin.fenggeyanse = initialThemes;
	// console.log("fenggeyanse",duixin.fenggeyanse);
	uni.setNavigationBarColor({
		backgroundColor: this.fenggeyanse =='light'? '#ffffff':'#151515',
		frontColor: this.fenggeyanse =='light'? '#000000':'#ffffff',
	})
  },
    methods: {


		formSubmit: function (e) {
		  var url = '../list/list';
		  var key = '';
			 //console.log('earch');
			  if (e.currentTarget.id == "search-input") {
				key = e.detail.value;
			  } else {
				key = e.detail.value.input;
			  }

			  if (key != '') {
				url = url + '?search=' + key;
				uni.navigateTo({
				  url: url
				});
			  } else {
				uni.showModal({
				  title: '提示',
				  content: '请输入内容',
				  showCancel: false
				});
			  }
		},
		
		fetchTopFivePosts: function () {
		  var self = this; //获取滑动图片的文章
		  var getPostsRequest = wxRequest.getRequest(Api.getSwiperUrl());
		  getPostsRequest.then(response => {
			
			if (response.data.code == 1) {
			  self.setData({
				postsShowSwiperList: self.postsShowSwiperList.concat(response.data.data.map(function (item) {
				  if (!item.thumb) {
					item.thumb = "/static/images/logo700.png";
				  }
				  item.redicttype = 'apppage';
				  item.url = '../detail/detail?id=' + item.id;
				  return item;
				})),
				displaySwiper: "block"
			  });
			} else {
			  self.setData({
				displaySwiper: "none"
			  });
			}
		  }).catch(function (response) {
			console.log(response);
			self.setData({
			  showerror: "block",
			  floatDisplay: "none"
			});
		  }).finally(function () {});
		},
		//获取列表数据
		fetchPostsData: function (data) {
		  var self = this;
		  if (!data) data = {};
		  if (!data.page) data.page = 1;
		  if (!data.categories) data.categories = 0;
		  if (!data.search) data.search = '';
		  if (self.uid) data.uid = self.uid;
		  console.log('uid:',self.uid);

		  if (data.page === 1) {
			self.setData({
			  postsList: []
			});
		  }

		  ;
		  self.setData({
			isLoading: true
		  });
	  

			var getPostsRequest = wxRequest.getRequest(Api.getRemenlistUrl(data));
			getPostsRequest.then(response => {
				//console.log(response.data.data);
			if (response.data.code == 1) {
				if (response.data.data.length) {
					self.fenggemoren = response.data.data[0].fengge;
					self.fenggekaiguan = response.data.data[0].fenggekaiguan;
				  if (response.data.data.length < pageCount) {
					self.setData({
					  isLastPage: true,
					  isLoading: false
					});
				  }

				  self.setData({
					floatDisplay: "block",
					postsList: self.postsList.concat(response.data.data.map(function (item) {
				
					  if (item.thumb == null || item.thumb == '') {
						item.thumb = "/static/images/logo700.png";
					  }

					  return item;
					}))
				  });
				} else {
				  if (response.data.code == "rest_post_invalid_page_number") {
					self.setData({
					  isLastPage: true,
					  isLoading: false
					});
					uni.showToast({
					  title: '没有更多内容',
					  mask: false,
					  duration: 1500
					});
				  } else {
					  // 隐藏提示
					/*uni.showToast({
					  title: response.data.message,
					  duration: 1500
					});*/
					self.daodi = true;
					uni.showToast({
					  title: '没有更多内容',
					  duration: 500
					});
				  }
				}
			  }
			}).catch(function (response) {
			  if (data.page == 1) {
				self.setData({
				  showerror: "block",
				  floatDisplay: "none"
				});
			  } else {
				uni.showModal({
				  title: '加载失败',
				  content: '加载数据失败,请重试.',
				  showCancel: false
				});
				self.setData({
				  page: data.page - 1
				});
			  }
			}).finally(function (response) {
			  uni.hideLoading();
			  self.setData({
				isLoading: false
			  });
			  uni.stopPullDownRefresh();
			});
		},
		//加载分页
		loadMore: function (e) {
		  var self = this;

		  if (!self.isLastPage) {
			self.setData({
			  page: self.page + 1
			}); //console.log('当前页' + self.data.page);

			this.fetchPostsData(self);
		  } else {
			uni.showToast({
			  title: '没有更多内容',
			  mask: false,
			  duration: 1000
			});
		  }
		},
		// 跳转至查看文章详情
		redictDetail: function (e) {
		  // console.log('查看文章');
		  var id = e.currentTarget.id,
			  url = '../detail/detail?id=' + id;
		  uni.navigateTo({
			url: url
		  });
		},
		//首页图标跳转
		onNavRedirect: function (e) {
		  var redicttype = e.currentTarget.dataset.redicttype;
		  var url = e.currentTarget.dataset.url == null ? '' : e.currentTarget.dataset.url;
		  var appid = e.currentTarget.dataset.appid == null ? '' : e.currentTarget.dataset.appid;
		  var extraData = e.currentTarget.dataset.extraData == null ? '' : e.currentTarget.dataset.extraData;

		  if (redicttype == 'apppage') {
			//跳转到小程序内部页面         
			uni.navigateTo({
			  url: url
			});
		  } else if (redicttype == 'webpage') //跳转到web-view内嵌的页面
			{
			  url = '../webpage/webpage?url=' + url;
			  uni.navigateTo({
				url: url
			  });
			} else if (redicttype == 'miniapp') //跳转到其他app
			{
			  uni.navigateToMiniProgram({
				appId: appid,
				envVersion: 'release',
				path: url,
				extraData: extraData,

				success(res) {// 打开成功
				},

				fail: function (res) {
				  console.log(res);
				}
			  });
			}
		},
		// 跳转至查看小程序列表页面或文章详情页
		redictAppDetail: function (e) {
		  // console.log('查看文章');
		  var id = e.currentTarget.id;
		  var redicttype = e.currentTarget.dataset.redicttype;
		  var url = e.currentTarget.dataset.url == null ? '' : e.currentTarget.dataset.url;
		  var appid = e.currentTarget.dataset.appid == null ? '' : e.currentTarget.dataset.appid;

		  if (redicttype == 'detailpage') //跳转到内容页
			{
			  url = '../detail/detail?id=' + id;
			  uni.navigateTo({
				url: url
			  });
			}

		  if (redicttype == 'apppage') {
			//跳转到小程序内部页面         
			uni.navigateTo({
			  url: url
			});
		  } else if (redicttype == 'webpage') //跳转到web-view内嵌的页面
			{
			  url = '../webpage/webpage?url=' + url;
			  uni.navigateTo({
				url: url
			  });
			} else if (redicttype == 'miniapp') //跳转到其他app
			{
			  uni.navigateToMiniProgram({
				appId: appid,
				envVersion: 'release',
				path: url,

				success(res) {// 打开成功
				},

				fail: function (res) {
				  console.log(res);
				}
			  });
			}
		},
		//内容帖子
		tiezi(quanid,tieid) {
			var duixin = this;
			// console.log('查看帖子');
			var url = '../tiezi/tiezi?qid='+quanid+'&id='+tieid+'&qid='+ duixin.qid;
			uni.navigateTo({
				url: url
			});
		},
		//点赞值
		dianzan(index,tieid) {
			var that = this;
			var getZanRequest = wxRequest.getRequest(Api.getZan(tieid,that.uid,that.userInfo));
			var res;
			getZanRequest.then(response => {
				res = response;
				if(res.data.code) {
					if(res.data.msg.status == 1) {
						if (this.postsList[index].zanzhi == 0) {
							this.postsList[index].zanzhi = 1;
							uni.showToast({
								title: res.data.msg.value+' '+res.data.msg.jifen,
								icon: 'success',
								duration: 2000
							});
						} else {
							this.postsList[index].zanzhi = 0;
							uni.showToast({
								title: res.data.msg.value+' '+res.data.msg.jifen,
								icon: 'success',
								duration: 2000
							});
						}
					} else {
						this.postsList[index].zanzhi = 0;
						uni.showToast({
							title: res.data.msg.value+' '+res.data.msg.jifen,
							icon: 'success',
							duration: 2000
						});
					}
				} else {
				  /*uni.showToast({
					icon: 'none',
					title: '获取失败，请稍后重试000'
				  });*/
				  uni.showModal({
				  	title: '请先登录',
				  	//content: '请先登录',
				  	confirmText: '前往登录',
				  	success: function(res) {
				  		if (res.confirm) {
				  			uni.redirectTo({
				  				url: '/pages/login/login'
				  			});
				  		}
				  	}
				  });
				  // uni.reLaunch({ url: '/pages/login/login'}) // 跳转到登录页
				}
			})
			//console.log("帖子index",index);
			//console.log("帖子tieid",tieid);
		},
		//返回首页
		redictHome: function (e) {
		  //console.log('查看某类别下的文章');  
		  var id = e.currentTarget.dataset.id,
			  url = '/pages/index/index';
		  uni.switchTab({
			url: url
		  });
		},
		// 个人页面
		getgeren(uid) {
			console.log('uid点击',uid);
			var url = '../u/index?&uid='+uid;
			uni.navigateTo({
				url: url
			});
		},
		fenggeclose(){
			this.fenggeshow = false
		},
		fenggeopen(){
			this.fenggeshow = true
		},
		fenggevalues(e){
			var duixin = this;
			duixin.fenggezhi = e.index+1;
			duixin.fengge = e.index+1;
			//console.log('duixin.fenggevalue', duixin.fenggezhi);
			uni.setStorageSync('fenggezhi', e.index+1);
			var StorageSync = uni.getStorageSync('fenggezhi', e.index+1);
			//console.log('StorageSync缓存值：', StorageSync);
			
		},
		
    },
	computed: {
		
	},

};
</script>
<style lang="scss">

page {
	background-color: #f3f4f7;
}
.album {
	@include flex;
	align-items: flex-start;

	&__avatar {
		 background-color: $u-bg-color;
		 padding: 1px;
		 border-radius: 50rpx;
	 }

	&__content {
		 margin-left: 10px;
		 flex: 1;
	 }
}
.d-fenggegao {
	height: 550rpx;
}
</style>